
$(function (){

    let today = new Date();

    let time = today.toLocaleString();
    time = time.replace(new RegExp('/','g'),'-');

    $(".createTime").val(time);

    // 获取当前登录用户名
    $.ajax({
        url:"/user/getLoginUser",
        type:"post",
        data:{},
        dataType: "json",
        success:function (result){
            if (result!=null){
                $("input[name='createUser']").val(result.uname);
            }
        }
    })


    $(".addBrandBtn").click(function (){
        // 获取input框的内容
        let brandName = $(".dfinput").val();
        let brandStatus = $(".dfselect").val();

        // 获取当前登录用户信息
        $.ajax({
            url:"/brandManage/addBrand",
            type:"post",
            data:{"brandName":brandName,"brandStatus":brandStatus},
            dataType:"json",
            success:function (result){
                if (result == true){
                    alert("添加品牌成功");
                }else {
                    alert("添加品牌失败");
                }
            }
        })
    })





})